package net.pws.oos.web.dto;

import java.util.ArrayList;
import java.util.List;

import net.pws.common.beanutils.BeanUtils;
import net.pws.oos.biz.model.Attachment;

import org.springframework.web.multipart.MultipartFile;

public class AttachmentDto extends Attachment {

	private static final long serialVersionUID = 358913968581677758L;

	public static AttachmentDto from(Attachment attachment) {
		AttachmentDto dto = new AttachmentDto();
		BeanUtils.copyProperties(dto, attachment);
		return dto;
	}
	
    public static List<AttachmentDto> from(List<Attachment> attachments) {
        List<AttachmentDto> list = new ArrayList<AttachmentDto>();
        if (attachments != null) {
            for (Attachment attachment : attachments) {
                list.add(from(attachment));
            }
        }
        return list;
    }

	private MultipartFile file;
	
	private List<PhotoMarkerDto> photoMarkers;
	
	// 扩展的json字符串
	private String json;

	public MultipartFile getFile() {
		return file;
	}

	public void setFile(MultipartFile file) {
		this.file = file;
	}

	public String getJson() {
		return json;
	}

	public void setJson(String json) {
		this.json = json;
	}

	public List<PhotoMarkerDto> getPhotoMarkers() {
		return photoMarkers;
	}

	public void setPhotoMarkers(List<PhotoMarkerDto> photoMarkers) {
		this.photoMarkers = photoMarkers;
	}
}
